<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Point{
            constructor(x=0,y=0){
                this.x = x;
                this.y = y;
            }

            distance_to(other){
                let dx = this.x - other.x;
                let dy = this.y - other.y;
                return (dx ** 2 + dy **2)**0.5;
            }

            show(){
                document.write(`横坐标${this.x}纵坐标${this.y}`);
            }
        }

        const p1 = new Point(3,5);
        p1.show()

        const p2 = new Point(6,9);
        p2.show()

        let res = p1.distance_to(p2);

        console.log(res);
    </script>
</body>
</html>